package com.lx.javasunmmrize.thread;

/**
 * @Description 创建线程2种方法1:继承Thread类
 *      main线程和自定义线程交替执行
 *
 * @Author lx
 * @Date 2021/3/1 21:30
 **/
public class MyThred extends Thread{

    public static void main(String[] args) {
        MyThred myThred = new MyThred();
        myThred.start();

        for (int i = 0; i < 100; i++) {
            System.out.println("main线程运行中-------"+i);
        }

    }

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println("继承Thread创建线程"+i);
        }

    }
}